package com.springBoot.springBootSysCore.modules.entity.system;

import java.util.Date;
import java.util.List;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.springBoot.springBootSysCore.common.comment.annotation.MyComment;
import com.springBoot.springBootSysCore.common.persistence.DataEntity;
/**
 * 消息
 * @author 枫叶
 * @DateTime 2015年7月24日 下午2:31:08
 * @Decribe education com.sfkj.platform.entity.message Message
 * @Version 1.0
 */
@Entity
@Table(name="SYS_MESSAGE")
@MyComment("消息表")
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler","createBy"})
public class SysMessage  extends DataEntity<SysMessage>{
	private static final long serialVersionUID = 1L;
	private String title;//消息名称
	private String describe;//消息描述
	private String details;//图文
	private String messAgeType;//消息类型 系统消息 如：开播  公告消息：图文详情
	private String objId;//跳转id

	private Boolean readed=Boolean.FALSE;//是否已读(true/是,false/否)
	private SysUser toSysUser;//消息接受者--单纯只给这个用户发的消息--统一发的消息日志记录不在这边记录

	private List<SysMessageLog> sysMessageLogs;
	
	@Column(name="TITLE",length=256)
	@MyComment("消息名称")
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	@Lob
	@Column(name="DESCRIBES",length=4000)
	@MyComment("消息描述")
	public String getDescribe() {
		return describe;
	}
	public void setDescribe(String describe) {
		this.describe = describe;
	}
	@Lob
	@Column(name="DETAILS",length=4000)
	@MyComment("消息详情")
	public String getDetails() {
		return details;
	}

	public void setDetails(String details) {
		this.details = details;
	}

	@Column(name="MESSAGE_TYPE")
	@MyComment("消息类型")
	public String getMessAgeType() {
		return messAgeType;
	}
	public void setMessAgeType(String messAgeType) {
		this.messAgeType = messAgeType;
	}

	public String getObjId() {
		return objId;
	}

	public void setObjId(String objId) {
		this.objId = objId;
	}

	@Column(name="readed")
	@MyComment("是否已读(true/是,false/否)")
	public Boolean getReaded() {
		return readed;
	}
	public void setReaded(Boolean readed) {
		this.readed = readed;
	}
	@ManyToOne
	@JoinColumn(name="TO_SYSUSER")
	@MyComment("消息接收者")
	@JsonIgnore
	public SysUser getToSysUser() {
		return toSysUser;
	}
	public void setToSysUser(SysUser toSysUser) {
		this.toSysUser = toSysUser;
	}


	@OneToMany(mappedBy = "sysMessage", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })
	@JsonIgnore
	public List<SysMessageLog> getSysMessageLogs() {
		return sysMessageLogs;
	}
	public void setSysMessageLogs(List<SysMessageLog> sysMessageLogs) {
		this.sysMessageLogs = sysMessageLogs;
	}
}
